package com.service;

import com.bean.Bumen;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component//一定不要忘记
public class BumenFallbackFactory implements FallbackFactory<BumenService> {
    @Override
    public BumenService create(Throwable throwable) {
        return new BumenService() {
            @Override
            public boolean addBumen(Bumen bumen) {
                return false;
            }

            @Override
            public List<Bumen> getAll() {
                return null;
            }

            @Override
            public Bumen getBumenById(Integer id) {
                return new Bumen().setBm_id(id).setBm_name("该id没有对应的信息，Consumer客服端提供的降级信息，此服务provider已关闭");
            }
        };
    }
}
